package com.wanshu.controller;


import com.alibaba.fastjson.JSON;
import com.wanshu.entity.Dish;
import com.wanshu.service.DishService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@CrossOrigin("http://localhost:8080")
@RequestMapping("/dish")
public class DishController {
    @Resource
    private DishService dishService;

    @RequestMapping("/findDishByShopId")
    public String findDishByShopId(Integer shopId){
        List<Dish> byShopId = dishService.findByShopId(shopId);
        return JSON.toJSONString(byShopId);
    }
}
